import React from 'react';
import { Descriptions } from 'antd';
import Area from '../../Form/Area/Area';

/**
 * 验收资料基本信息
 */
function BasicArea(props) {
    const { data = {} } = props;

    const items = [
        { label: '验收资料名称', children: data.acceptanceMaterialName },
        { label: '云区域', children: data.cloudRegionName },
        { label: '资源归属省分', children: data.cloudRegionProvinceName },
        { label: '资源池类型', children: data.cloudRegionTypeCn },
        { label: '申请类型', children: data.applyTypeCn },
        { label: '资源池架构', children: data.cloudArchitectureCn },
        { label: '软件版本', children: data.softwareVersion },
        { label: '存储类型', children: data.storageTypeCn },
        { label: '对象存储编码方式', children: data.objectStorageCode },
        { label: '是否有等保安全设备', children: data.isSecurityDevicesCn },
        { label: '资源池网络出口带宽', children: data.cloudNetOutBandwidth && `${data.cloudNetOutBandwidth}Mb/s` },
        { label: '创建人', children: data.creatorName },
        { label: '创建时间', children: data.createTime },
        { label: '最后更新人', children: data.updatePersonName },
        { label: '最后更新时间', children: data.updateTime },
        { label: '回复', children: data.replyDraft },
    ];

    const renderItem = ({ children, ...item }, index) => {
        return (
            <Descriptions.Item key={index} {...item}>
                {children || '-'}
            </Descriptions.Item>
        );
    };

    return (
        <Area title="验收资料">
            <Descriptions>{items.map(renderItem)}</Descriptions>
        </Area>
    );
}

export default BasicArea;
